<?php

$app = app();
$languagePath = '';
if(config('app.language_path')) {
    $languagePath = config('app.language_path').'/';
}
$app->router->group([
    'namespace' => 'App\Sys\Controllers',
    'prefix' => $languagePath.'api',
], function ($router) {
    // 国际化资源文件生成工具
    $router->get('/i18n/resource-list', 'SysI18nController@getAppResource');
    $router->get('/i18n/resource-query', 'SysI18nController@lists');
    $router->post('/i18n/resource-save', 'SysI18nController@saveAll');
    $router->post('/i18n/resource-edit', 'SysI18nController@save');
    $router->post('/i18n/resource-confirm', 'SysI18nController@confirm');
    $router->get('/i18n/resource-locale', 'SysI18nController@getAppLocale');
    $router->group([
        'middleware' => ['admin.auth']
    ], function ($router) {
        // 翻译接口
        $router->get('/api/basic/translate', 'SysI18nController@translate');
        $router->post('/api/basic/translate', 'SysI18nController@translate');
    });

    $router->get('/sys/province-list', 'SysController@getProvinceList');
});